﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using IQKS.AWP.DataAccessLayer;
using IQKS.AWP.BusinessObject;

namespace IQKS.AWP.BusinessAccessLayer
{
    public class AssessorInvoiceBAL
    {
        public DataSet GetAssessorInvoice()
        {
            DataSet objDs;
            try
            {
                objDs = new AssessorInvoiceDAL().GetAssessorInvoice(0);

            }
            catch (Exception exception)
            {
                throw new ApplicationException(exception.Message);
            }
            return objDs;
        }

        public DataSet GetInvoiceByAssessorID(params object[] param)
        {
            DataSet objDs;
            try
            {
                objDs = new AssessorInvoiceDAL().GetInvoiceByAssessorID(param);

            }
            catch (Exception exception)
            {
                throw new ApplicationException(exception.Message);
            }
            return objDs;
        }



        public AssessorInvoiceBO GetAssessorInvoice(params object[] param)
        {

            AssessorInvoiceBO objAIMBo;
            try
            {

                objAIMBo = new AssessorInvoiceBO();
                DataSet objDs;
                objDs = new AssessorInvoiceDAL().GetAssessorInvoice(param);
                if (objDs != null)
                {
                    DataTable objDt = objDs.Tables[0];
                    if (objDt != null)
                    {
                       
                        objAIMBo.InvoiceID = Convert.ToInt32(objDt.Rows[0]["InvoiceID"]);
                        objAIMBo.InvoiceNo = Convert.ToString(objDt.Rows[0]["InvoiceNo"]);
                        objAIMBo.InvoiceDate = Convert.ToDateTime(objDt.Rows[0]["InvoiceDate"]);
                        objAIMBo.InvoiceAmount = Convert.ToInt32(objDt.Rows[0]["InvoiceAmount"]);
                        objAIMBo.InvoicePath = Convert.ToString(objDt.Rows[0]["InvoicePath"]);
                        objAIMBo.InvoiceComment = Convert.ToString(objDt.Rows[0]["InvoiceComment"]);
                        objAIMBo.CandidatIDList = Convert.ToString(objDt.Rows[0]["CandidateIDList"]);
                        
                      

                    }
                    else
                    {
                        objAIMBo = null;
                    }
                }

            }
            catch (Exception exception)
            {
                throw new ApplicationException(exception.Message);
            }
            return objAIMBo;
        }


        public object SetAssessorInvoice(AssessorInvoiceBO param)
        {
            try
            {
                return new AssessorInvoiceDAL().SetAssessorInvoice(param);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }
        public DataSet GetCandidateByAssessor(Guid AssessorUserID)
        {
            DataSet objDs;
            try
            {
                objDs = new AssessorInvoiceDAL().GetCandidateByAssessor(AssessorUserID);

            }
            catch (Exception exception)
            {
                throw new ApplicationException(exception.Message);
            }
            return objDs;
        }
        public object SetUploadAssessorInvoice(AssessorInvoiceBO param)
        {
            try
            {
                return new AssessorInvoiceDAL().SetUploadAssessorInvoice(param);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }
        public DataSet GetInvoiceDetailByInvoiceID(params object[] param)
        {

            DataSet objDs;
            try
            {
                objDs = new AssessorInvoiceDAL().GetInvoiceDetailByInvoiceID(param);

            }
            catch (Exception exception)
            {
                throw new ApplicationException(exception.Message);
            }
            return objDs;

        }
    }
}
